/**
 * yiqihao copyright 
 */
package com.p2p.front.model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.CollectionUtils;

import com.p2p.base.model.Money;
import com.p2p.front.dal.model.ChargeLogSummary;

/**
 * 
 * @author leiruiqi@yiqihao.com
 *
 *
 * 2015年1月22日 下午2:10:12
 */
public class ChargeSumView extends ChargeLogSummary{

	private Map<String,ChargeLogSummary> chargeLogSummaryMap = new HashMap<String,ChargeLogSummary>();
	
	private List<ChargeLogSummary> chargeLogSummaryList;

	public Map<String, ChargeLogSummary> getChargeLogSummaryMap() {
		return chargeLogSummaryMap;
	}

	public ChargeSumView() {
		// TODO Auto-generated constructor stub
	}
	
	public ChargeSumView(List<ChargeLogSummary> chargeLogSummaryList){
		this.chargeLogSummaryList = chargeLogSummaryList;
		init();
	}
	public void setChargeLogSummaryMap(
			Map<String, ChargeLogSummary> chargeLogSummaryMap) {
		this.chargeLogSummaryMap = chargeLogSummaryMap;
	}
	
	public List<ChargeLogSummary> getChargeLogSummaryList() {
		return chargeLogSummaryList;
	}

	public void setChargeLogSummaryList(List<ChargeLogSummary> chargeLogSummaryList) {
		this.chargeLogSummaryList = chargeLogSummaryList;
	}

	public void init(){
		if(CollectionUtils.isEmpty(chargeLogSummaryList)){
			return;
		}
		Money all = new Money();
		for(ChargeLogSummary chargeLogSummary:chargeLogSummaryList){
			chargeLogSummaryMap.put(chargeLogSummary.getType(), chargeLogSummary);
			all.add(chargeLogSummary.getAmount());
		}
		this.setAmount(all);
	}
	
}
